//
//  MusicCollectionViewCell.m
//  悦享
//
//  Created by dllo on 16/3/18.
//  Copyright © 2016年 张洪国. All rights reserved.
//

#import "MusicCollectionViewCell.h"
#import <UIImageView+WebCache.h>
@interface MusicCollectionViewCell ()

/// 歌单图片
@property (nonatomic, retain) UIImageView *imgView;
/// 歌单简介
@property (nonatomic, retain) UILabel *infoLabel;

@end

@implementation MusicCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        [self createViews];
    }
    return self;
    
}

- (void)setModel:(MusicModel *)model {
    
    _model = model;
    
    [_imgView sd_setImageWithURL:[NSURL URLWithString:_model.pic_url] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];
    _infoLabel.text = _model.title;
    
}

- (void)createViews {
    
    self.imgView = [[UIImageView alloc] init];
    [self.contentView addSubview:_imgView];
    
    self.infoLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_infoLabel];
    
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    
    self.imgView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 30);
//    self.imgView.backgroundColor = [UIColor cyanColor];
    
    self.infoLabel.frame = CGRectMake(0, self.imgView.frame.size.height, self.contentView.frame.size.width, 30);
//    self.infoLabel.backgroundColor = [UIColor yellowColor];
    
}


@end









